﻿using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Padsurface.App.Tests.Unit.Stubs;
using Padsurface.App.Views;
using Padsurface.Audio.Song.Model;

namespace Padsurface.App.Tests.Unit.ViewModels.StartViewModelSpecifications
{
    public abstract class WhenCreateSong : StartViewModelTestBase
    {
        public object ExecuteParameter { get; set; }

        protected override void Act()
        {
            if (ViewModel.CreateSongCommand.CanExecute(ExecuteParameter))
                ViewModel.CreateSongCommand.Execute(ExecuteParameter);
        }
    }

    [TestClass]
    public class WhenCreateGivenSongIsActive : WhenCreateSong
    {
        [TestMethod]
        public void ThenActiveSongShouldBeCleared()
        {
            Assert.AreEqual(1, ActiveSongCache.ClearCallCount);
        }

        [TestMethod]
        public void ThenAppShouldNavigateToSong()
        {
            Assert.IsTrue((ViewModel.NavigationService as NavigationServiceStub).NavigatedPages.Contains(typeof(PadPage)));
        }
    }
}
